package com.zjs.controller;


import com.zjs.common.lang.Result;
import com.zjs.dao.vo.TagVo;
import com.zjs.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2022-02-22
 */
@RestController
@RequestMapping("/tags")
public class TagController {


    @Autowired
    private TagService tagsService;

    /**
     * 最热标签
     * @return
     */
    @GetMapping("hot")
    public Result hot(){
        int limit = 6;
        return tagsService.hots(limit);
    }

    /**
     * 获取所有分类
     * @return
     */
    @GetMapping
    public Result findAll(){
        return tagsService.findAll();
    }

    /**
     * 获取分类详细
     * @return
     */
    @GetMapping("detail")
    public Result findAllDetail(){
        return tagsService.findAllDetail();
    }

    @GetMapping("detail/{id}")
    public Result findDetailById(@PathVariable("id") Long id){
        return tagsService.findDetailById(id);
    }


}
